package com.hnhs.mapper;

import com.hnhs.info.CateproInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CateProMapper {

    @Select("SELECT c.name as category_name,COUNT(p.id) as product_count\n" +
            "FROM 202_category c LEFT JOIN 202_product p ON c.id = p.categoryId WHERE c.status =1 GROUP BY c.id,c.name")
    public List<CateproInfo> selectByCount();
}
